package cn.edu.nju.software.puzzle;

import java.io.File;
import java.util.*;

public class Main {

	public static void main(String[] args) throws Exception  {
		//long one=benchmark();
		File squareFile = new File("square.txt");
		File dictFile = new File("dict.txt");
		if (squareFile.exists() && dictFile.exists()) {
			WordPuzzle puzzle = new WordPuzzle(squareFile, dictFile);
			Set<String> words = puzzle.find();
			if (words != null) {
				for (String word : words) {
					System.out.println(word);
				}
			} else {
				System.out.println("No word found!");
			}
			System.out.println(words.size());
		} else {
			System.err.println("Input file missing!");
		}
		//long two=benchmark();
		//System.out.println(two-one);
	}
	/*public static long benchmark(){
		GregorianCalendar a=new GregorianCalendar();
		long now=a.getTimeInMillis();
		return now;
	}
	*/

}
